package org.dru.clay.util.file;

import java.io.File;

import org.dru.clay.util.functional.Predicate;

/**
 * AbstractFileSet
 * User: joakimd
 * Date: 2013-07-24
 * Time: 13:00
 */
public abstract class AbstractFileSet implements FileSet {
    private final File dir;

    protected AbstractFileSet(final File dir) {
        if (!dir.isAbsolute() || !dir.isDirectory()) {
            throw new IllegalArgumentException("dir is not an absolute file to a directory: " + dir);
        }
        this.dir = dir;
    }

    @Override
    public final File getDir() {
        return dir;
    }

	@Override
	public final FileSet filter(Predicate<File> predicate) {
		return new FilteredFileSet(this, predicate);
	}
}
